<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <canvas id="canvas"></canvas>
    <script>
        const canvas = document.querySelector('#canvas')
        const ctx = canvas.getContext("2d")
        ctx.fillStyle = "green"
        
        document.addEventListener('mousedown',(e) => {
           document.addEventListener('mousemove', (e) => {
            console.log(e.clientX,e.clientY)
            ctx.beginPath(100, 200)
            ctx.closePath(100,200)
           })
        })
    </script>
</body>

</html>